Try to show how easy it can be to load files and use built in data values. (also show the difference in monthly average concentration due to rounding.)


In [ ]:
import rockbag as rb
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
mpl.rcParams["figure.facecolor"] = "white"
mpl.rcParams["axes.facecolor"] = "white"
mpl.rcParams["savefig.facecolor"] = "white"
import numpy as np

In [ ]:
# stub list of files for 2012 09
def get_files():
    files = ["/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120901_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120902_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120903_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120904_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120905_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120906_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120907_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120908_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120909_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120910_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120911_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120912_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120913_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120914_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120915_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120916_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120917_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120918_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120919_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120920_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120921_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120922_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120923_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120924_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120925_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120926_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120927_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120928_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120929_f17_v01_n.bin",
             "/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/daily/2012/nt_20120930_f17_v01_n.bin"]
    return files

In [ ]:
files = get_files()

In [ ]:
def load_month(files):
    cube = np.dstack(tuple([file_data(f) for f in files]))
    return cube

In [ ]:
def file_data(file):
    a = rb.suckgrid(file, gpd='N3B', header=300)
    return a

In [ ]:
z = load_month(get_files())
average = z.mean(axis=2)
stddev = z.std(axis=2)

any missing data in the set?


In [ ]:
np.any(z == 255)

In [ ]:
np.any((average > 100) & (average < 250))

In [ ]:
with mpl.rc_context(rc={'figure.figsize': (10,9), 'axes.grid':False}, ):
    plt.imshow(stddev)

In [ ]:
with mpl.rc_context(rc={'figure.figsize': (10,9), 'axes.grid':False}, ):
    plt.imshow(average)

In [ ]:
month_file = '/projects/DATASETS/nsidc0051_gsfc_nasateam_seaice/final-gsfc/north/monthly/nt_201209_f17_v01_n.bin'
gsfc_month_data  = rb.suckgrid(month_file, gpd='N3B', header=300)

In [ ]:
with mpl.rc_context(rc={'figure.figsize': (10,9), 'axes.grid':False}, ):
    plt.imshow(gsfc_month_data)

In [ ]:
np.min(gsfc_month_data[gsfc_month_data > 0])

In [ ]:
np.min(average[average > 0])

In [ ]:
gsfc_month_data

In [ ]:
diff = average - gsfc_month_data

In [ ]:
with mpl.rc_context(rc={'figure.figsize': (10,9), 'axes.grid':False}, ):
    plt.imshow(np.abs(diff) > .6, cmap="Blues")

In [ ]:
(np.abs(diff) > .6).sum()

In [ ]:
with mpl.rc_context(rc={'figure.figsize': (10,9), 'axes.grid':False}, ):
    plt.imshow(np.abs(diff) > .5, cmap="Blues")

total points different by more than .5


In [ ]:
(np.abs(diff) > .5).sum()

In [ ]:
with mpl.rc_context(rc={'figure.figsize': (10,9), 'axes.grid':False}, ):
    plt.imshow(np.abs(diff) > .2, cmap="Blues")

In [ ]: